package cn.tedu.service.impl;

import cn.tedu.mapper.UserMapper;
import cn.tedu.pojo.User;
import cn.tedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户Service接口实现类
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
    // 注入UserDao
    @Autowired
    private UserMapper userMapper;
    // 通过账号和密码查询用户
    @Override
    public User findUser(String usercode, String password) {
        User user = this.userMapper.findUser(usercode, password);
        return user;
    }

    @Override
    public User regUser(String usercode) {
        User user = this.userMapper.regUser(usercode);
        return user;
    }

    @Override
    public void addUser(String usercode, String password) {
        User user = this.userMapper.addUser(usercode, password);
    }
}

